﻿using gt.IdentityServer.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;

namespace gt.IdentityServer.Services
{
    public interface ILoginService
    {
        /// <summary>
        /// 获取登录用户
        /// </summary>
        /// <param name="userName">登录名</param>
        /// <param name="password">登录密码</param>
        /// <returns>验证成功返回登录用户信息,只包括本身信息；验证失败返回null</returns>
        Task<AppUser> FindLoginUserAsync(string userName, string password);
        /// <summary>
        /// 获取用户完成信息，包括组权限等
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        Task<AppUser> FindUserInfoByIdAsync(int userId);
        /// <summary>
        /// 获取用户权限列表
        /// </summary>
        /// <param name="user">登录用户</param>
        /// <returns></returns>
        List<AppUserRole> GetRolesByUser(AppUser user);
        /// <summary>
        /// 获取登录 Claims
        /// </summary>
        /// <param name="user">登录user</param>
        /// <returns></returns>
        IEnumerable<Claim> GetClaims(AppUser user);
    }
}
